<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../jsp_header.jsp" %>	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
<style type="text/css">
#constainer{
width: 1092px;
padding-left: 32px;
padding-right: 32px;
position: relative;
margin: 0 auto;
padding: 0 16px 50px;
border-right: 1px solid #eee;
border-left: 1px solid #eee;
}
</style>
<link type="text/css" rel="stylesheet" href="/resources/common/adminCommon.css"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script language="javascript">

			function Check_Value() {
				if (!form2.o_name.value) {
					alert("주문자 이름이 잘 못 되었습니다.");	form2.o_name.focus();	return;
				}
				if (!form2.o_tel1.value || !form2.o_tel2.value || !form2.o_tel3.value) {
					alert("전화번호가 잘 못 되었습니다.");	form2.o_tel1.focus();	return;
				}
				if (!form2.o_phone1.value || !form2.o_phone2.value || !form2.o_phone3.value) {
					alert("핸드폰이 잘 못 되었습니다.");	form2.o_phone1.focus();	return;
				}
				if (!form2.o_email.value) {
					alert("이메일이 잘 못 되었습니다.");	form2.o_email.focus();	return;
				}
				if (!form2.o_zip1.value || !form2.o_zip2.value) {
					alert("우편번호가 잘 못 되었습니다.");	form2.o_zip1.focus();	return;
				}
				if (!form2.o_juso.value) {
					alert("주소가 잘 못 되었습니다.");	form2.o_email.focus();	return;
				}

				if (!form2.r_name.value) {
					alert("받으실 분의 이름이 잘 못 되었습니다.");	form2.r_name.focus();	return;
				}
				if (!form2.r_tel1.value || !form2.r_tel2.value || !form2.r_tel3.value) {
					alert("전화번호가 잘 못 되었습니다.");	form2.r_tel1.focus();	return;
				}
				if (!form2.r_phone1.value || !form2.r_phone2.value || !form2.r_phone3.value) {
					alert("핸드폰이 잘 못 되었습니다.");	form2.r_phone1.focus();	return;
				}
				if (!form2.r_email.value) {
					alert("이메일이 잘 못 되었습니다.");	form2.r_email.focus();	return;
				}
				if (!form2.r_zip1.value || !form2.r_zip2.value) {
					alert("우편번호가 잘 못 되었습니다.");	form2.r_zip1.focus();	return;
				}
				if (!form2.r_juso.value) {
					alert("주소가 잘 못 되었습니다.");	form2.r_email.focus();	return;
				}

				document.form2.submit();
			}

			function FindZip(zip_kind) 
			{
				window.open("zipcode.html?zip_kind="+zip_kind, "", "scrollbars=no,width=500,height=250");
			}

			function SameCopy(str) {
				if (str == "Y") {
					form2.r_name.value = form2.o_name.value;
					form2.r_zip1.value = form2.o_zip1.value;
					form2.r_zip2.value = form2.o_zip2.value;
					form2.r_juso.value = form2.o_juso.value;
					form2.r_tel1.value = form2.o_tel1.value;
					form2.r_tel2.value = form2.o_tel2.value;
					form2.r_tel3.value = form2.o_tel3.value;
					form2.r_phone1.value = form2.o_phone1.value;
					form2.r_phone2.value = form2.o_phone2.value;
					form2.r_phone3.value = form2.o_phone3.value;
					form2.r_email.value = form2.o_email.value;
				}
				else {
					form2.r_name.value = "";
					form2.r_zip1.value = "";
					form2.r_zip2.value = "";
					form2.r_juso.value = "";
					form2.r_tel1.value = "";
					form2.r_tel2.value = "";
					form2.r_tel3.value = "";
					form2.r_phone1.value = "";
					form2.r_phone2.value = "";
					form2.r_phone3.value = "";
					form2.r_email.value = "";
				}
			}
			function Check_Value() 
			{
				if (form2.pay_method[0].checked)
				{
					if (!form2.card_kind.value) {
						alert("카드종류를 선택하세요.");	form2.card_kind.focus();	return;
					}
					if (!form2.card_no1.value || form2.card_no1.value.length!=4) {
						alert("카드번호를 입력하세요.");	form2.card_no1.focus();	return;
					}
					if (!form2.card_no2.value || form2.card_no2.value.length!=4) {
						alert("카드번호를 입력하세요.");	form2.card_no2.focus();	return;
					}
					if (!form2.card_no3.value || form2.card_no3.value.length!=4) {
						alert("카드번호를 입력하세요.");	form2.card_no3.focus();	return;
					}
					if (!form2.card_no4.value || form2.card_no4.value.length!=4) {
						alert("카드번호를 입력하세요.");	form2.card_no4.focus();	return;
					}
					if (!form2.card_year.value) {
						alert("카드기간 년도를 선택하세요.");	form2.card_year.focus();	return;
					}
					if (!form2.card_month.value) {
						alert("카드기간 월을 선택하세요.");	form2.card_month.focus();	return;
					}
					if (!form2.card_password.value) {
						alert("카드 암호 뒷의 2자리를 선택하세요.");	form2.card_pw.focus();	return;
					}
				}
				else
				{
					if (!form2.bank_kind.value) {
						alert("입금할 은행을 선택하세요.");	form2.bank_kind.focus();	return;
					}
					if (!form2.bank_sender.value) {
						alert("입금자 이름을 입력하세요.");	form2.bank_sender.focus();	return;
					}
				}
				
				document.form2.submit();
			}

			function PaySel(n) 
			{
				if (n == 0) {
					form2.card_kind.disabled = false;
					form2.card_no1.disabled = false;
					form2.card_no2.disabled = false;
					form2.card_no3.disabled = false;
					form2.card_no4.disabled = false;
					form2.card_year.disabled = false;
					form2.card_month.disabled = false;
					form2.card_password.disabled = false;
					form2.bank_kind.disabled = true;
					form2.bank_sender.disabled = true;
				}
				else {
					form2.card_kind.disabled = true;
					form2.card_no1.disabled = true;
					form2.card_no2.disabled = true;
					form2.card_no3.disabled = true;
					form2.card_no4.disabled = true;
					form2.card_year.disabled = true;
					form2.card_month.disabled = true;
					form2.card_password.disabled = true;
					form2.bank_kind.disabled = false;
					form2.bank_sender.disabled = false;
				}
			}
			</script>
</head>
<body style="margin:0">
	    
	<jsp:include page="../main_header.jsp"></jsp:include>
		
	<!-- 사이드바 -->
<center>


<!-------------------------------------------------------------------------------------------->	
<!-- 시작 : 다른 웹페이지 삽입할 부분                                                       -->
<!-------------------------------------------------------------------------------------------->	

			<!--  현재 페이지 자바스크립  -------------------------------------------->
		<div id="constainer" class="full">
		<table  width="959" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td></td>
		</tr>
		</table>
		<br><br>
		<div class="title">
		<h2 class="kr">주문/결제</h2>
		</div>	
			<table border="0" cellpadding="0" cellspacing="0" width="959" align="center">
				<a ><img src="/resources/image/orderimg	.PNG"></a>
			</table>

			<table border="0" cellpadding="0" cellspacing="0" width="959" align="center">
				<tr><td height="13"></td></tr>
				<tr>
					<td height="30" align="center"></td>
				</tr>
				<tr><td height="13"></td></tr>
			</table>


			<table border="0" cellpadding="5" cellspacing="1" width="900"  class="cmfont" bgcolor="#CCCCCC">
				<tr bgcolor="F0F0F0" height="23" class="cmfont">
					<td width="440" align="center" style="height: 39px; ">상품</td>
					<td width="70"  align="center">수량</td>
					<td width="100" align="center">가격</td>
					<td width="100" align="center">합계</td>
				</tr>
			<c:choose>
				<c:when test="${itemDirectList == null}">
					<c:forEach items="${sessionScope.itemList}" var="itemList" varStatus="cnt">
						
						<tr bgcolor="#FFFFFF">
							<td height="60" align="center">
								<table cellpadding="0" cellspacing="0" width="100%">
									
									<tr>
										<td width="60">
											<a href="product_detail.html?no=0000"><img src="/resources/image/${itemList.image}" width="50" height="50" border="0"></a>
										</td>
										<td class="cmfont">
											<a href="product_detail.html?no=0000"><font color="#0066CC">${itemList.name}</font></a><br>
											[옵션]${itemList.opts1} ${itemList.opts2}
										</td>
									</tr>
								</table>
							</td>
							<td align="center"><font color="#464646">${itemList.quantity}개</font></td>
							<td align="center"><font color="#464646"><fmt:formatNumber value="${itemList.price}" type="currency"/></font> 원</td>
							<td align="center"><font color="#464646"></font><fmt:formatNumber value="${itemList.quantity * itemList.price}" type="currency"/>원</td>
						</tr>
						</c:forEach> 
					</c:when>
					
					<c:when test="${itemDirectList != null }">
						<c:forEach items="${itemDirectList}" var="itemDirectList" varStatus="cnt">
							<tr bgcolor="#FFFFFF">
							<td height="60" align="center">
								<table cellpadding="0" cellspacing="0" width="100%">
									
									<tr>
										<td width="60">
											<a href="product_detail.html?no=0000"><img src="/resources/image/${itemDirectList.image}" width="50" height="50" border="0"></a>
										</td>
										<td class="cmfont">
											<a href="product_detail.html?no=0000"><font color="#0066CC">${itemDirectList.name}</font></a><br>
											[옵션]${itemDirectList.opts1} ${itemDirectList.opts2}
										</td>
									</tr>
								</table>
							</td>
							<td align="center"><font color="#464646">${itemDirectList.quantity}개</font></td>
							<td align="center"><font color="#464646"><fmt:formatNumber value="${itemDirectList.price}" type="currency"/></font> 원</td>
							<td align="center"><font color="#464646"></font><fmt:formatNumber value="${itemDirectList.quantity * itemDirectList.price}" type="currency"/>원</td>
						</tr>
						</c:forEach>
					</c:when>
				</c:choose>
				
				
				<tr>
					<td colspan="5" bgcolor="#F0F0F0">
						<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmfont">
							<tr>
								<td bgcolor="#F0F0F0"><img src="/resources/image/cart_image1.gif" border="0"></td>
								<td align="right" height="23"bgcolor="#F0F0F0">
									<font color="#0066CC"><b>총 합계금액</font></b> : 상품대금(${AmountTotal }) + 배송료(2,500원) = <font color="#FF3333"><b><fmt:formatNumber value="${AmountTotal +2500 }" type="currency" /> 원</b></font>&nbsp;&nbsp
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<br><br>

			<!-- 주문자 정보 -->
			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr height="3" bgcolor="#CCCCCC"><td></td></tr>
			</table>

			<!-- form2 시작  -->
			<form name="form2" method="post" action="/order/orderInsert">
			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">

						<table width="900" border="0" cellpadding="0" cellspacing="0" class="cmfont">
							<tr height="25">
								<td width="150" height="50" style="background: #f6f6f6"><b>주문자 성명</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #f5f5f5">
									<input type="hidden" name="no" value="${sessionScope.loginUser.no}">
									<input type="text"   name="name" size="20" maxlength="10" value="${sessionScope.loginUser.user_id}" class="cmfont1" style="height: 20px; ">
								</td>
							</tr>
							<tr  height="50">
								<td width="150"style="background: #f6f6f6"><b>휴대폰번호</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<!-- <input type="text" name="o_phone1" size="4" maxlength="4" value="" class="cmfont1"> -
									<input type="text" name="o_phone2" size="4" maxlength="4" value="" class="cmfont1"> -
									<input type="text" name="o_phone3" size="4" maxlength="4" value="" class="cmfont1"> -->
									<input type="text" name="phone" size="20" maxlength="20" style="height: 20px; " value="${sessionScope.loginUser.phone}" class="cmfont1">
								</td>
							</tr>
							<tr  height="50">
								<td width="150"style="background: #f6f6f6"><b>E-Mail</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<input type="text" name="email" size="50" maxlength="50" style="height: 20px; " value="${sessionScope.loginUser.email}" class="cmfont1">
								</td>
							</tr>
							<tr height="50">
								<td width="150"style="background: #f6f6f6"><b>주소</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<input type="text" name="postcode" size="8" maxlength="8" style="height: 20px; " value="${sessionScope.loginUser.postcode}" class="cmfont1">
									<input type="text" name="address" size="50" maxlength="200" style="height: 20px; " value="${sessionScope.loginUser.address}" class="cmfont1"><br>
								</td>
								<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>결재방법 선택</b></td>
								<td width="20"></td>
								<td width="390"style="border-bottom:1px solid #e6e6e6">
									<input type="radio" name="pay_method" value="0" onclick="javascript:PaySel(0);" checked>카드 &nbsp;
									<input type="radio" name="pay_method" value="1" onclick="javascript:PaySel(1);">무통장
								</td>
							</tr>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>카드종류</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<select  height="40" name="card_kind" class="cmfont1">
										<option value="">카드종류를 선택하세요.</option>
										<option value="국민은행">국민카드</option>
										<option value="신한은행">신한카드</option>
										<option value="우리은행">우리카드</option>
										<option value="기업은행">IBK카드</option>
									</select>
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>카드번호</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<input type="text" style="height: 20px; " name="card_no1" size="4" maxlength="4" value="" class="cmfont1"> -
									<input type="text" style="height: 20px; " name="card_no2" size="4" maxlength="4" value="" class="cmfont1"> -
									<input type="text" style="height: 20px; "name="card_no3" size="4" maxlength="4" value="" class="cmfont1"> -
									<input type="text" style="height: 20px; " name="card_no4" size="4" maxlength="4" value="" class="cmfont1">
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>카드기간</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<input type="text" style="height: 20px; " name="card_month" size="2" maxlength="2" value="" class="cmfont1"> 월 / 
									<input type="text" style="height: 20px; " name="card_year"  size="2" maxlength="2" value="" class="cmfont1"> 년
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>카드비밀번호(뒷2자리)</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									**<input type="password" style="height: 20px; " name="card_password" size="2" maxlength="2" value="" class="cmfont1">
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>할부</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<select  height="50" name="card_halbu" class="cmfont1">
										<option value="0">일시불</option>
										<option value="3">3 개월</option>
										<option value="6">6 개월</option>
										<option value="9">9 개월</option>
										<option value="12">12 개월</option>
									</select>
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>은행선택</b></td>
								<td width="20"></td>
								<td width="390" style="border-bottom:1px solid #e6e6e6">
									<select  height="50" name="bank_kind"  class="cmfont1" disabled>
										<option value="">입금할 은행을 선택하세요.</option>
										<option value="국민은행">국민은행 000-00000-0000</option>
										<option value="신한은행">신한은행 000-00000-0000</option>
										<option value="우리은행">우리은행 000-00000-0000</option>
										<option value="기업은행">기업은행 000-00000-0000</option>
									</select>
								</td>
							</tr>
							<tr height="25">
								<td width="150"  height="50"style="background: #f6f6f6"><b>입금자 이름</b></td>
								<td width="20"></td>
								<td width="390">
									<input type="text" style="height: 20px; " name="bank_sender" size="15" maxlength="20" value="" class="cmfont1" disabled>
								</td>
							</tr>
						</table>

					</td>
				</tr>
				<tr height="10"></tr>
			</table>

			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr>
					
				</tr>
				<tr height="10"></tr>
			</table>

			
			<!-- 카드 -->
			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr>
					
				</tr>
				<tr height="10"></tr>
			</table>

			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr height="1" bgcolor="#CCCCCC"></tr>
				<tr height="10"></tr>
			</table>
			<!-- 무통장 -->
			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr>
					
				</tr>
				<tr height="10"></tr>
			</table>
			
			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				
				<tr height="10"></tr>
			</table>
			<!-- 주문자 배송 정보 -->
			
			
			</form>

			<table width="710" border="0" cellpadding="0" cellspacing="0" class="cmfont">
				<tr>
					<td align="center" style="width: 150px; ">
						<img src="/resources/image/orderimg2.PNG" onclick="javascript:Check_Value()" style="cursor:hand">
					<a href="/"><img src="/resources/image/orderimg3.PNG"  ></a>
					</td>
					
				</tr>
				<tr height="20"><td></td></tr>
			</table>



<br><br>
&nbsp
</div>
</center>
<jsp:include page="../main_bottom.jsp"></jsp:include>
</body>
</html>